<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<form class="well form-search" method="post" action="{:U('AdminPost/wechat', array('single' => $single, 'dialogid' => $dialogid))}">
			分类： 
			<select class="select_2" name="term">
				<option value='0'>全部</option>{$taxonomys}
			</select> &nbsp;&nbsp;
			关键字： 
			<input type="text" name="keyword" style="width: 100px;" value="{$formget.keyword}" placeholder="请输入关键字...">
			<input type="submit" class="btn btn-primary" value="搜索" />
		</form>
		<table class="table table-hover table-bordered table-list">
			<thead>
				<tr>
					<th>ID</th>
					<th>{:L('TITLE')}</th>
					<th>{:L('CATEGORY')}</th>
					<th width="50">{:L('THUMBNAIL')}</th>
					<th width="50">{:L('STATUS')}</th>
					<th width="30">{:L('ACTIONS')}</th>
				</tr>
			</thead>
			<php>
			$status=array("1"=>"已审核","0"=>"未审核");
			$top_status=array("1"=>"已置顶","0"=>"未置顶");
			$recommend_status=array("1"=>"已推荐","0"=>"未推荐");
			</php>
			<foreach name="posts" item="vo">
			<php>
				$vo['subtitle'] = empty($vo['post_excerpt']) ? trim(strip_tags($vo['post_content'])) : $vo['post_excerpt'];
				$vo['subtitle'] = msubstr($vo['subtitle'], 0, 50);
			</php>
			<tr>
				<td>{$vo.tid}</td>
				<td><a href="{:U('portal/article/index',array('id'=>$vo['tid']))}" target="_blank"> <span>{$vo.post_title}</span></a></td>
				<td>{$terms[$vo['term_id']]}</td>
				<td>
					<php>$smeta=json_decode($vo['smeta'],true);</php>
					<if condition="!empty($smeta['thumb'])">
						<img src="{:sp_get_asset_upload_path($smeta['thumb'])}" width="60px" />
					</if>
				</td>
				<td>{$status[$vo['post_status']]}<br>{$top_status[$vo['istop']]}<br>{$recommend_status[$vo['recommended']]}
				</td>
				<td>
					<a oid="{$vo.tid}" from="portal" title="{$vo.post_title}" thumb="{:sp_get_asset_upload_path($smeta['thumb'])}" subtitle="{$vo.subtitle}" name="doselect" href="#">选中</a>
				</td>
			</tr>
			</foreach>
		</table>
		<div class="pagination">{$Page}</div>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript">
	$(function() {
		var single = {$single};
		$('a[name="doselect"]').each(function() {
			$(this).bind('click', function() {
				var data = {
					oid : $(this).attr('oid'),
					from : $(this).attr('from'),
					title : $(this).attr('title'),
					thumb : $(this).attr('thumb'),
					subtitle : $(this).attr('subtitle')
				};
				var length = 0;
				if(single === 0) {
					length = $('ul[class="multiarticle"]', window.parent.document).find('li').length;
					if(length >= 10) {
						error('多图文最多可以添加10条!');
						return false;
					}
					parent.multArticleInsert(data);
				} else {
					parent.singleArticleInsert(data);
				}
				return false;
			});
		});
	});
	</script>
</body>
</html>